<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Netty 高性能架构解析</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        
        .card-hover {
            transition: all 0.3s ease;
            border: 2px solid transparent;
        }
        
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 40px rgba(0,0,0,0.1);
            border-color: #667eea;
        }
        
        .feature-icon {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }
        
        .section-title {
            position: relative;
            padding-left: 20px;
        }
        
        .section-title::before {
            content: '';
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            width: 4px;
            height: 30px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 2px;
        }
        
        .mermaid {
            background: white;
            padding: 2rem;
            border-radius: 1rem;
            box-shadow: 0 10px 30px rgba(0,0,0,0.1);
        }
        
        .drop-cap {
            float: left;
            font-size: 4rem;
            line-height: 1;
            font-weight: 700;
            margin-right: 0.5rem;
            margin-top: -0.2rem;
            color: #667eea;
            font-family: 'Noto Serif SC', serif;
        }
        
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        .animate-fadeInUp {
            animation: fadeInUp 0.8s ease-out;
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-6">
        <div class="max-w-6xl mx-auto text-center animate-fadeInUp">
            <h1 class="text-5xl md:text-6xl font-bold mb-6" style="font-family: 'Noto Serif SC', serif;">
                Netty 高性能架构解析
            </h1>
            <p class="text-xl md:text-2xl mb-8 opacity-90">
                深入探索 Java 网络编程框架的性能奥秘
            </p>
            <div class="flex justify-center space-x-8 text-sm">
                <div class="flex items-center">
                    <i class="fas fa-rocket mr-2"></i>
                    <span>极致性能</span>
                </div>
                <div class="flex items-center">
                    <i class="fas fa-network-wired mr-2"></i>
                    <span>异步非阻塞</span>
                </div>
                <div class="flex items-center">
                    <i class="fas fa-memory mr-2"></i>
                    <span>高效内存管理</span>
                </div>
            </div>
        </div>
    </section>

    <!-- Introduction -->
    <section class="py-16 px-6">
        <div class="max-w-4xl mx-auto bg-white rounded-2xl shadow-xl p-10">
            <p class="text-lg leading-relaxed text-gray-700">
                <span class="drop-cap">N</span>etty 作为当今最流行的 Java 网络编程框架，其卓越的性能表现源于精心设计的架构和多项关键技术的协同作用。从高效的 I/O 线程模型到智能的内存管理策略，从零拷贝技术到异步非阻塞机制，每一个设计决策都体现了对性能的极致追求。让我们深入探索这些让 Netty 如此强大的核心要素。
            </p>
        </div>
    </section>

    <!-- Architecture Visualization -->
    <section class="py-16 px-6 bg-gray-50">
        <div class="max-w-6xl mx-auto">
            <h2 class="text-3xl font-bold text-center mb-12 text-gray-800">Netty 架构全景图</h2>
            <div class="mermaid">
                graph TB
                    A[Netty 高性能架构] --> B[I/O 线程模型]
                    A --> C[内存管理]
                    A --> D[数据处理]
                    A --> E[异步非阻塞]
                    A --> F[连接管理]
                    A --> G[扩展性配置]
                    
                    B --> B1[Reactor 模型]
                    B --> B2[事件驱动]
                    
                    C --> C1[内存池化]
                    C --> C2[直接内存]
                    
                    D --> D1[零拷贝]
                    D --> D2[编解码优化]
                    
                    E --> E1[异步处理]
                    E --> E2[事件循环]
                    
                    F --> F1[连接池]
                    F --> F2[连接优化]
                    
                    G --> G1[插件架构]
                    G --> G2[参数配置]
                    
                    style A fill:#667eea,stroke:#fff,stroke-width:3px,color:#fff
                    style B fill:#f59e0b,stroke:#fff,stroke-width:2px,color:#fff
                    style C fill:#10b981,stroke:#fff,stroke-width:2px,color:#fff
                    style D fill:#3b82f6,stroke:#fff,stroke-width:2px,color:#fff
                    style E fill:#ef4444,stroke:#fff,stroke-width:2px,color:#fff
                    style F fill:#8b5cf6,stroke:#fff,stroke-width:2px,color:#fff
                    style G fill:#ec4899,stroke:#fff,stroke-width:2px,color:#fff
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <section class="py-16 px-6">
        <div class="max-w-6xl mx-auto">
            <!-- Feature 1: I/O Thread Model -->
            <div class="mb-16 card-hover bg-white rounded-2xl shadow-lg p-8">
                <h3 class="section-title text-2xl font-bold mb-6 text-gray-800">
                    <i class="fas fa-microchip feature-icon mr-3"></i>
                    高效的 I/O 线程模型
                </h3>
                <div class="grid md:grid-cols-2 gap-6">
                    <div class="bg-gradient-to-br from-purple-50 to-pink-50 p-6 rounded-xl">
                        <h4 class="font-semibold text-lg mb-3 text-purple-800">
                            <i class="fas fa-atom mr-2"></i>Reactor 线程模型
                        </h4>
                        <p class="text-gray-700 leading-relaxed">
                            Netty 采用经典的 Reactor 模式，将 I/O 事件处理与业务逻辑处理分离。主线程专注于接收连接请求，工作线程负责处理具体业务，这种职责分离的设计极大提升了系统的并发处理能力。
                        </p>
                    </div>
                    <div class="bg-gradient-to-br from-blue-50 to-cyan-50 p-6 rounded-xl">
                        <h4 class="font-semibold text-lg mb-3 text-blue-800">
                            <i class="fas fa-bolt mr-2"></i>事件驱动架构
                        </h4>
                        <p class="text-gray-700 leading-relaxed">
                            基于事件驱动的设计理念，Netty 将所有 I/O 操作抽象为事件，通过高效的事件循环机制处理。这种非阻塞的处理方式使得单个线程就能管理成千上万的并发连接。
                        </p>
                    </div>
                </div>
            </div>

            <!-- Feature 2: Memory Management -->
            <div class="mb-16 card-hover bg-white rounded-2xl shadow-lg p-8">
                <h3 class="section-title text-2xl font-bold mb-6 text-gray-800">
                    <i class="fas fa-memory feature-icon mr-3"></i>
                    高效的内存管理
                </h3>
                <div class="grid md:grid-cols-2 gap-6">
                    <div class="bg-gradient-to-br from-green-50 to-emerald-50 p-6 rounded-xl">
                        <h4 class="font-semibold text-lg mb-3 text-green-800">
                            <i class="fas fa-swimming-pool mr-2"></i>内存池化
                        </h4>
                        <p class="text-gray-700 leading-relaxed">
                            通过 ByteBuf 池化机制，Netty 实现了内存的高效复用。这种设计减少了频繁的内存分配和释放操作，有效降低了内存碎片化和垃圾回收的压力。
                        </p>
                    </div>
                    <div class="bg-gradient-to-br from-yellow-50 to-orange-50 p-6 rounded-xl">
                        <h4 class="font-semibold text-lg mb-3 text-yellow-800">
                            <i class="fas fa-database mr-2"></i>直接内存
                        </h4>
                        <p class="text-gray-700 leading-relaxed">
                            利用 Direct ByteBuffer，Netty 避免了 JVM 堆内存与操作系统之间的数据拷贝。直接内存的使用不仅提升了 I/O 性能，还减轻了垃圾回收的负担。
                        </p>
                    </div>
                </div>
            </div>

            <!-- Feature 3: Data Processing -->
            <div class="mb-16 card-hover bg-white rounded-2xl shadow-lg p-8">
                <h3 class="section-title text-2xl font-bold mb-6 text-gray-800">
                    <i class="fas fa-exchange-alt feature-icon mr-3"></i>
                    高效的数据处理
                </h3>
                <div class="grid md:grid-cols-2 gap-6">
                    <div class="bg-gradient-to-br from-indigo-50 to-purple-50 p-6 rounded-xl">
                        <h4 class="font-semibold text-lg mb-3 text-indigo-800">
                            <i class="fas fa-magic mr-2"></i>零拷贝技术
                        </h4>
                        <p class="text-gray-700 leading-relaxed">
                            Netty 的零拷贝技术通过直接内存和内存映射文件，实现了数据在不同 I/O 操作间的高效传递，避免了不必要的数据复制，显著降低了 CPU 负载。
                        </p>
                    </div>
                    <div class="bg-gradient-to-br from-pink-50 to-rose-50 p-6 rounded-xl">
                        <h4 class="font-semibold text-lg mb-3 text-pink-800">
                            <i class="fas fa-code mr-2"></i>高效的编解码机制
                        </h4>
                        <p class="text-gray-700 leading-relaxed">
                            提供灵活的编解码器链机制，支持自定义协议的快速处理。这种设计使得数据的序列化和反序列化过程更加高效，减少了处理延迟。
                        </p>
                    </div>
                </div>
            </div>

            <!-- Feature 4: Async I/O -->
            <div class="mb-16 card-hover bg-white rounded-2xl shadow-lg p-8">
                <h3 class="section-title text-2xl font-bold mb-6 text-gray-800">
                    <i class="fas fa-sync-alt feature-icon mr-3"></i>
                    异步和非阻塞 I/O
                </h3>
                <div class="grid md:grid-cols-2 gap-6">
                    <div class="bg-gradient-to-br from-red-50 to-pink-50 p-6 rounded-xl">
                        <h4 class="font-semibold text-lg mb-3 text-red-800">
                            <i class="fas fa-tasks mr-2"></i>异步处理
                        </h4>
                        <p class="text-gray-700 leading-relaxed">
                            所有 I/O 操作均采用异步非阻塞方式，应用程序无需等待操作完成即可继续执行其他任务，极大提升了系统的响应性和吞吐量。
                        </p>
                    </div>
                    <div class="bg-gradient-to-br from-cyan-50 to-blue-50 p-6 rounded-xl">
                        <h4 class="font-semibold text-lg mb